package com.boge.modules.shop.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.boge.common.utils.ShiroUtils;
import com.boge.modules.sys.controller.WebController;
import com.boge.modules.sys.entity.SysUserEntity;
import com.boge.modules.sys.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.boge.common.utils.PageUtils;
import com.boge.common.utils.Query;

import com.boge.modules.shop.dao.CollectDao;
import com.boge.modules.shop.entity.CollectEntity;
import com.boge.modules.shop.service.CollectService;


@Service("collectService")
public class CollectServiceImpl extends ServiceImpl<CollectDao, CollectEntity> implements CollectService {



    @Autowired
    private SysUserService userService;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        SysUserEntity loginUser = ShiroUtils.getUserEntity();
        IPage<CollectEntity> page = this.page(
                new Query<CollectEntity>().getPage(params),
                new LambdaQueryWrapper<CollectEntity>()
                        .eq(!"admin".equals(loginUser.getUsername()),CollectEntity::getUserId,loginUser.getUserId())
        );

        List<CollectEntity> records = page.getRecords();
        if(records != null){
            for (CollectEntity record : records) {

            }
        }

        return new PageUtils(page);
    }

}